package thread;

import java.util.Scanner;

public class SleepDemo {
    public static void main(String[] args) {
        System.out.println("输入要倒计时的时间:");
        Scanner scan = new Scanner(System.in);
        int t = scan.nextInt();
        for (int i=t;i>0;i--) {
            try {
                System.out.println("还剩" + i + "秒");
                Thread.sleep(1000);
            } catch (InterruptedException e) {
            }
        }
        System.out.println("时间到");
    }
}
